<!--  发布  -->
<template>
  <div>
    <van-nav-bar title="发布" />
    <van-cell-group v-if="jobCategoryArr.length > 0">
      <van-cell v-for="item in jobCategoryArr" :title="`发布${item.value}招聘`" is-link :icon="item.icon"
        @click="toPublishPage(item.key)" :key="item.key" />
    </van-cell-group>
  </div>
</template>

<script>
import { Toast } from 'vant'
const jobCategoryArr = [
  {
    key: '1',
    value: '全职',
    icon: 'hot-o'
  },
  {
    key: '2',
    value: '兼职',
    icon: 'aim'
  },
  {
    key: '3',
    value: '小时工',
    icon: 'balance-o'
  }
]
export default {
  name: 'publish',
  data() {
    return {
      jobCategoryArr,
      userinfo: null
    }
  },

  created() {
    let allCertificate = window.localStorage.getItem('allCertificate')
    if (allCertificate) {
      this.$store.dispatch('getUserAllInfo')
    }
  },

  mounted() {
    this.userinfo = JSON.parse(localStorage.getItem('userInfo'))
    // console.log(this.userinfo, 'this.userinfo')
  },
  methods: {
    toPublishPage(id) {
      if (this.userinfo.user_status === 1) {
        Toast(`当前账号已被举报限制，请联系近聘客服。`)
        return
      }
      // 三种动态路由： https://blog.csdn.net/weixin_42679187/article/details/89396851
      this.$router.push({
        path: '/allTypeJobs',
        query: {
          id
        }
      })
    }
  }
}
</script>

<style scoped></style>
